Create factorial_iterative.py#13793
Create factorial_iterative.py#13793agarwalpranay02 wants to merge 5 commits intoTheAlgorithms:masterfrom
Conversation
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
maths/factorial_iterative.py
Outdated
| @@ -0,0 +1,16 @@ | |||
| def factorial_iterative(n: int) -> int: | |||
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file maths/factorial_iterative.py, please provide doctest for the function factorial_iterative
Please provide descriptive name for the parameter: n
Address review: add doctests and descriptive parameter name
for more information, see https://pre-commit.ci
Add iterative GCD implementation
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
maths/gcd_iterative.py
Outdated
| @@ -0,0 +1,13 @@ | |||
| def gcd_iterative(a: int, b: int) -> int: | |||
There was a problem hiding this comment.
Please provide descriptive name for the parameter: a
Please provide descriptive name for the parameter: b
Fix: replace single letter parameters with descriptive names
|
We already have it in https://github.com/TheAlgorithms/Python/blob/master/maths/factorial.py#L6-L35 |
Describe your change
Created a new Python file
factorial_iterative.pyimplementing the factorial function using an iterative approach. This algorithm was not present earlier. Included type hints and a Wikipedia reference as required.Checklist